package com.yuzhi.master.sewage.device.mapper;

import com.yuzhi.common.core.mapper.BaseMapperPlus;
import com.yuzhi.master.sewage.device.domain.DrainDevice;
import com.yuzhi.master.sewage.device.domain.vo.DrainDeviceVo;
import com.yuzhi.master.sewage.device.domain.vo.DtainDeviceAppVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * 排水设备表 DAO
 */
@Mapper
public interface DrainDeviceMapper extends BaseMapperPlus<DrainDeviceMapper, DrainDevice, DrainDeviceVo> {


    List<DtainDeviceAppVo> searchByName(String name, Integer type);

    List<DtainDeviceAppVo> findNearby(String longitude, String latitude);

    List<Map<String, String>> batchGetFactoryNames(@Param("ids") Collection<String> ids);

    /**
     * 根据用户ID查询部门ID
     *
     * @param userId 用户ID
     * @return 部门ID
     */
    @Select("SELECT dept_id FROM psbiz.sys_user_dept WHERE user_id = #{userId}")
    String getDeptIdByUserId(@Param("userId") String userId);
}
